<template>
	<view class="content" v-if="status==0">
	<form>
			<!-- 表单内容 -->
			<view class="form-item">
				<text class="label">姓名</text>
				<input class="input" placeholder="请填写姓名" value="" v-model="form.user"/>
			</view>
			<view class="form-item">
				<text class="label">手机号码</text>
				<input class="input" placeholder="请填写手机号码" value="" v-model="form.phone" />
			</view>
			<view class="form-item">
				<text class="label">所在地区</text>
				<input class="input" placeholder="省/市/区(县)" value="" v-model="form.province"/>
			</view>
			<view class="form-item">
				<text class="label">身份证号</text>
				<input class="input" placeholder="身份证号码" value="" v-model="form.code"/>
			</view>
			
		</form>
	
	<!-- 提交按钮 -->
	<button class="button" @click="saveAddress">提交审核</button>
	</view>
	
	<view class="payment-success" v-if="status==1">
		<view class="title">实名成功</view>
		<view class="icon-container">
			<!-- <image src="/static/success-icon.png" class="success-icon"></image> -->
			<uni-icons type="checkbox" size="120" color="#4caf50"></uni-icons>
		</view>
		<view class="message">感谢您的使用</view>
		<view class="button-container">
			<button class="button1" @click="navigateToIndex()">返回</button>
		</view>
	</view>
</template>


<script>
import { ref } from 'vue'

export default {
  data() {
    return {
      form: {
        user: '', // 收货人
        phone: '', // 联系方式
        province: '', // 省市区(前端展示)
		code: '', // 详细地址
		remark: uni.getStorageSync('account_key')
      },
	  status: 0,
    }
  },
  onShow() {
  	this.getInfo()
  },
 
   methods: {
	   //审合通过点击按钮
	   navigateToIndex() {
	         uni.navigateBack({delta: 1})
	       },
	   
	   //获取鉴定信息
	   getInfo(){
		   uni.request({
		   	url: 'http://localhost:8080/api/companion/identify/check',
			header: {
				account: uni.getStorageSync('account_key')
			},		   		 	   	
		   	method: 'GET',
		   	success: (res) => {
				
		   		this.status =res.data.data;
		   		} 
		   	}
		   )
	   },
	
      saveAddress() {
        // 模拟发送表单数据到后端的操作
        uni.request({
        	url: 'http://localhost:8080/api/companion/identify/add',
        	data: 
        		 this.form
				 
        	,
        	method: 'Post',
        	success: (res) => {
        		if (res.data.code == '200') {
        			uni.showModal({
        				content: '提交成功等待审核',
        			});
					uni.navigateBack({delta:1})
        		} else {
        		   	
        		}
        	}
        })
      }
    }
}
</script>





<style lang="scss">
	page {
		background-color: #f4f4f4;
	}

	.content {
		margin: 20rpx 20rpx 0;
		padding: 0 20rpx;
		border-radius: 10rpx;
		background-color: #fff;

		.form-item,
		.uni-forms-item {
			display: flex;
			align-items: center;
			min-height: 96rpx;
			padding: 25rpx 10rpx;
			background-color: #fff;
			font-size: 28rpx;
			border-bottom: 1rpx solid #ddd;
			position: relative;
			margin-bottom: 0;

			// 调整 uni-forms 样式
			.uni-forms-item__content {
				display: flex;
			}

			.uni-forms-item__error {
				margin-left: 200rpx;
			}

			&:last-child {
				border: none;
			}

			.label {
				width: 200rpx;
				color: #333;
			}

			.input {
				flex: 1;
				display: block;
				height: 46rpx;
			}

			.switch {
				position: absolute;
				right: -20rpx;
				transform: scale(0.8);
			}

			.picker {
				flex: 1;
			}

			.placeholder {
				color: #808080;
			}
		}
	}

	.button {
		height: 80rpx;
		margin: 30rpx 20rpx;
		color: #fff;
		border-radius: 80rpx;
		font-size: 30rpx;
		background-color: #2c334d;
	}
	
	.payment-success {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 100vh;
		background-color: #f5f5f5;
	}
	
	.title {
		font-size: 24px;
		color: #333;
		margin-bottom: 20px;
	}
	
	.icon-container {
		margin-bottom: 30px;
	}
	
	.success-icon {
		width: 120px;
		height: 120px;
	}
	
	.message {
		font-size: 18px;
		color: #666;
		margin-bottom: 40px;
	}
	
	.button-container {
		margin-bottom: 20px;
	}
	
	.button1 {
		width: 200px;
		height: 40px;
		line-height: 40px;
		text-align: center;
		background-color: #4caf50;
		color: #fff;
		border: none;
		border-radius: 20px;
		font-size: 16px;
	}
	.button:hover {
	  background-color: #05a749;
	}
	
	
</style>